package com.szml.common.app.constant;

public enum OperationRecordStatus {

    ADDED(1, "新增"),
    APPROVAL_INITIATED(2, "发起审批"),
    APPROVED(3, "审批通过"),
    REJECTED(4, "审批驳回"),
    LAUNCHED(5, "上线"),
    TAKEN_OFFLINE(6, "下线");

    private final int code;
    private final String description;

    OperationRecordStatus(int code, String description) {
        this.code = code;
        this.description = description;
    }

    public int getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    // 根据编码获取枚举值，提供便捷方法
    public static OperationRecordStatus getByCode(int code) {
        for (OperationRecordStatus status : values()) {
            if (status.getCode() == code) {
                return status;
            }
        }
        throw new IllegalArgumentException("Invalid status code: " + code);
    }
}